import { getOrgMemberListApi } from '@/api/system/org'

// 获取部门成员列表hooks
export default function useGetOrgMemberList() {
  const memberOptions = ref([])
  const memberLoading = ref(false)
  const { userInfo } = getUserInfo()

  const fetchGetMemberList = async () => {
    memberLoading.value = true
    const res = await getOrgMemberListApi({
      id: userInfo.value.orgId as number
    })
    if (res.code === '0000') {
      memberOptions.value = res.data
    }
    memberLoading.value = false
  }

  fetchGetMemberList()

  return {
    fetchGetMemberList,
    memberOptions,
    memberLoading
  }
}
